#pragma once

#include "ColligereDataImporterBase.hpp"
#include "ColligereAudioDatabaseHandler.hpp"
#include "ColligereXmlUtils.hpp"

namespace col {

/*! @brief A class for importing collection from a OrangeCD XML-document.
 *
 * Currently imports artist and album information but does not
 * import e.g. separate artist information.
 **/
class OrangeCdXmlDataImporter : public XmlDataImporterBase
{
public:
	void Load ( const wxURI &rIn );
	void Import ( DatabaseInterfaceBase &rDest );
	//! Returns the count of "Album" nodes.
	wxUint32 GetItemCount() const;
protected:
	void InitializeItemFromNode ( const wxXmlNode *pNode, DatabaseItemBase &rItem ) const; 
private:
	/*! @brief Checks if the loaded document is a valid OrangeCD XML-document.
	 *
	 * Simply checks if the root node has the name "Collection".
	 *
	 * @return true if the document is valid, false otherwise.
	 **/
	bool IsValidOrangeCdXmlFile() const;

	void ParseTracks ( const wxXmlNode *pFromAlbumNode, Album &rToAlbum ) const;

	wxXmlDocument mInDoc;
};

}